package com.company;

import java.util.Scanner;

public class Task2 {
    public static void main(String[] args) {
        //todo 2.写一段死循环程序代码，30s后跳出循环。

        System.out.println("请输入等待时间（单位秒）：");
        Scanner scanner = new Scanner(System.in);
        int overTime = Integer.parseInt(scanner.next()) * 1000;//运行时间

        long beginTime = System.currentTimeMillis();//开始时间
        for (long i = 0; i >= 0; i++) {
            long nowTime = System.currentTimeMillis();
            if ((nowTime - beginTime) >= overTime){
                System.out.println("开始时间" + beginTime);
                System.out.println("当前时间" + nowTime);
                break;
            }

        }
    }
}
